package com.sg.web;

import com.sg.vo.ChartInfo;
import com.sg.service.UserService;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;
import java.util.Map;

/**
 * @author zl
 * 图形控制器
 */
@Controller
@RequestMapping("/admin")
public class ChartController {

    Logger logger = Logger.getLogger(ChartController.class);

    @Autowired
    UserService userService;


    @RequestMapping("/tochart")
    public String toChart(){
        logger.info("coming tochart...");
        return "chartstat";
    }

    @RequestMapping("/chartfirst")
    @ResponseBody
    public List<ChartInfo> chartfirst(){
        List<ChartInfo> list = userService.findStatPie();
        return list;
    }

    @RequestMapping("/chartsecode")
    @ResponseBody
    public Map<String,List> chartsecode(){
        Map<String,List> list = userService.findStatBar();
        return list;
    }
}
